package flower.com.a600_xm.adapter;

import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import flower.com.a600_xm.fragment.F10_Fragment;
import flower.com.a600_xm.fragment.F11_Fragment;
import flower.com.a600_xm.fragment.F12_Fragment;
import flower.com.a600_xm.fragment.F13_Fragment;
import flower.com.a600_xm.fragment.F1_Fragment;
import flower.com.a600_xm.fragment.F2_Fragment;
import flower.com.a600_xm.fragment.F3_Fragment;
import flower.com.a600_xm.fragment.F4_Fragment;
import flower.com.a600_xm.fragment.F5_Fragment;
import flower.com.a600_xm.fragment.F6_Fragment;
import flower.com.a600_xm.fragment.F7_Fragment;
import flower.com.a600_xm.fragment.F8_Fragment;
import flower.com.a600_xm.fragment.F9_Fragment;


/**
 * Created by 智江鹏 on 2016/11/18.
 * 采购订单适配器
 */

public class SynOrder_1_Buy_FragmentAdapter extends FragmentPagerAdapter {
    private String[] titleStr = null;
    F1_Fragment f1_fragment;
    F2_Fragment f2_fragment;

    F3_Fragment f3_fragment;
    F4_Fragment f4_fragment;

    F5_Fragment f5_fragment;
    F6_Fragment f6_fragment;


    F7_Fragment f7_fragment;
    F8_Fragment f8_fragment;

    F9_Fragment f9_fragment;
    F10_Fragment f10_fragment;

    F11_Fragment f11_fragment;
    F12_Fragment f12_fragment;

    F13_Fragment f13_fragment;


    FragmentManager fm;
    private static final String[] CONTENT = new String[]{"全部数据", "通便"
            , "安神促眠", "理气消食"
            , "清热泻火", "减脂除湿"
            , "增白美容", "强壮补益"
            , "止咳化痰", "对抗抑郁"
            , "止泄类", "发汗类"
            , "利尿类"
    };

    public SynOrder_1_Buy_FragmentAdapter(FragmentManager fm, Context context) {
        super(fm);
        titleStr = CONTENT;
        this.fm = fm;
    }

    @Override
    public Fragment getItem(int position) {
        switch (position) {
            case 0:
                if (f1_fragment == null) {
                    f1_fragment = new F1_Fragment();
                }
                return f1_fragment;
            case 1:
                if (f2_fragment == null) {
                    f2_fragment = new F2_Fragment();
                }
                return f2_fragment;


            case 2:
                if (f3_fragment == null) {
                    f3_fragment = new F3_Fragment();
                }
                return f3_fragment;
            case 3:
                if (f4_fragment == null) {
                    f4_fragment = new F4_Fragment();
                }
                return f4_fragment;


            case 4:
                if (f5_fragment == null) {
                    f5_fragment = new F5_Fragment();
                }
                return f5_fragment;
            case 5:
                if (f6_fragment == null) {
                    f6_fragment = new F6_Fragment();
                }
                return f6_fragment;
            case 6:
                if (f7_fragment == null) {
                    f7_fragment = new F7_Fragment();
                }
                return f7_fragment;

            case 7:
                if (f8_fragment == null) {
                    f8_fragment = new F8_Fragment();
                }
                return f8_fragment;


            case 8:
                if (f9_fragment == null) {
                    f9_fragment = new F9_Fragment();
                }
                return f9_fragment;

            case 9:
                if (f10_fragment == null) {
                    f10_fragment = new F10_Fragment();
                }
                return f10_fragment;


            case 10:
                if (f11_fragment == null) {
                    f11_fragment = new F11_Fragment();
                }
                return f11_fragment;

            case 11:
                if (f12_fragment == null) {
                    f12_fragment = new F12_Fragment();
                }
                return f12_fragment;
            case 12:
                if (f13_fragment == null) {
                    f13_fragment = new F13_Fragment();
                }
                return f13_fragment;
            default:
                return null;
        }
    }

    @Override
    public CharSequence getPageTitle(int position) {

        return titleStr[position];
    }

    @Override
    public int getItemPosition(Object object) {

        return POSITION_NONE;
    }

    @Override
    public int getCount() {

        return titleStr.length;
    }

}
